#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int Vmax = 0;
        while (left < right) {
            int h, v;

            if (height[left] < height[right]) {
                h = height[left];
                v = (right - left) * h;
                left++;
            }
            else {
                h = height[right];
                v = (right - left) * h;
                right--;
            }
            if (v > Vmax)
            {
                Vmax = v;
            }
        }
        return Vmax;
    }
};